package com.nx.edu;

import lombok.Data;

import java.lang.reflect.Proxy;
import java.util.ResourceBundle;

/**
 * @author Fxz
 * @version 1.0
 * @date 2021-08-12 8:57
 */
@Data
public class NxConfiguration {

    ResourceBundle sqlMap;

    public NxConfiguration() {
        this.sqlMap = ResourceBundle.getBundle("sql");
    }

    public <T> T getMapper(Class mapperClass, NxSqlSession nxSqlSession) {
        return (T) Proxy.newProxyInstance(
                this.getClass().getClassLoader(),
                new Class[]{mapperClass},
                new NxMapperProxy(nxSqlSession)
        );
    }
}
